
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>ambient.coarsen &#8212; Texas A&amp;M Oil spill / Outfall Calculator 2.1.0 documentation</title>
    <link rel="stylesheet" href="../../_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../_static/language_data.js"></script>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="ambient.stabilize" href="ambient.stabilize.html" />
    <link rel="prev" title="ambient.load_raw" href="ambient.load_raw.html" />
   
  <link rel="stylesheet" href="../../_static/custom.css" type="text/css" />
  
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  <div class="section" id="ambient-coarsen">
<h1>ambient.coarsen<a class="headerlink" href="#ambient-coarsen" title="Permalink to this headline">¶</a></h1>
<dl class="function">
<dt id="ambient.coarsen">
<code class="sig-prename descclassname">ambient.</code><code class="sig-name descname">coarsen</code><span class="sig-paren">(</span><em class="sig-param">raw</em>, <em class="sig-param">err=0.01</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/ambient.html#coarsen"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#ambient.coarsen" title="Permalink to this definition">¶</a></dt>
<dd><p>Reduce the size of a raw database for interpolation</p>
<p>Removes rows from the raw input database so that linear interpolation 
between rows in the new dataset recovers the original data within a 
relative error given by <cite>err</cite>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>raw</strong><span class="classifier">ndarray, shape(:,:)</span></dt><dd><p>An array of data with the independent variable (usually depth) 
in the first column and the dependent variable(s) in the remaining
columns.  Note that the first column is always ignored.</p>
</dd>
<dt><strong>err</strong><span class="classifier">float</span></dt><dd><p>The acceptable level of relative error for linear interpolation 
between rows in the output database</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>data</strong><span class="classifier">ndarray, shape(:,:)</span></dt><dd><p>An array of data in the same organization as the raw input array, but
generally with rows removed so that the interpolation error between
the output data set and the raw input data are within a relative 
error specified by err.</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">raw</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="mi">100</span><span class="p">,</span><span class="mi">3</span><span class="p">))</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">raw</span><span class="p">[:,</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span>     <span class="c1"># Vector of dependent variables</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">raw</span><span class="p">[:,</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">raw</span><span class="p">[:,</span><span class="mi">0</span><span class="p">])</span>  <span class="c1"># Fictitious dependent variable 1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">raw</span><span class="p">[:,</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="n">raw</span><span class="p">[:,</span><span class="mi">0</span><span class="p">]</span><span class="o">**</span><span class="mi">2</span>        <span class="c1"># Fictitious dependent variable 2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span> <span class="o">=</span> <span class="n">coarsen</span><span class="p">(</span><span class="n">raw</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">)</span>      <span class="c1"># Allow up to 50% error</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span><span class="o">.</span><span class="n">shape</span>
<span class="go">(13, 3)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span><span class="p">[:,</span><span class="mi">0</span><span class="p">]</span>
<span class="go">array([  0.,   1.,   2.,   3.,   5.,   8.,  12.,  17.,  25.,  36.,  51.,</span>
<span class="go">        73.,  99.])               # Note: data are resolved in areas</span>
<span class="go">                                  # with the greatest curvature (small z)</span>
</pre></div>
</div>
</dd></dl>

</div>


          </div>
          
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../../index.html">Texas A&M Oil spill / Outfall Calculator</a></h1>








<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../../user_manual.html">TAMOC User Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../unit_tests.html">Unit Tests</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary.html">Glossary</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../bugs.html">Reporting Bugs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../readme.html">Read Me File</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../release.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../license.html">License</a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="../../index.html">Documentation overview</a><ul>
  <li><a href="../../user_manual.html">TAMOC User Manual</a><ul>
  <li><a href="../../modules/ambient.html">Overview of Ambient Module</a><ul>
      <li>Previous: <a href="ambient.load_raw.html" title="previous chapter">ambient.load_raw</a></li>
      <li>Next: <a href="ambient.stabilize.html" title="next chapter">ambient.stabilize</a></li>
  </ul></li>
  </ul></li>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>








        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2020, Scott A. Socolofsky.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 2.4.4</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
      
      |
      <a href="../../_sources/autodoc/ambient/ambient.coarsen.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>